using System.Windows.Forms;

using GSN.Config;
using GSNConf.Senders.ConfigControls;
using GSNConf.GenConfigControls;

namespace GSNConf.Senders
{
    class MagtifunSenderConfigurator : IDictionaryConfigurator
    {
        public override bool show()
        {
            GenConfigForm form = new GenConfigForm(new MagtifunSenderConfigControl(), "Magtifun Settings");

            ((TextBox)form.Controls.Find("txtUsername", true)[0]).Text = getItemString("Username");
            ((TextBox)form.Controls.Find("txtPassword", true)[0]).Text = getItemString("Password");

            if (form.ShowDialog() == DialogResult.OK)
            {
                setItemString(((TextBox)form.Controls.Find("txtUsername", true)[0]).Text, "Username");
                setItemString(((TextBox)form.Controls.Find("txtPassword", true)[0]).Text, "Password");

                return true;
            }

            return false;

        }
    }
}
